package com.heima.behavior.controller;

import com.heima.behavior.service.UserBehaviorService;
import com.heima.model.behavior.dtos.LikesBehaviorDto;
import com.heima.model.behavior.dtos.ReadBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
public class UserBehaviorController {
    @Autowired
    private UserBehaviorService userBehaviorService;

    /**
     * 点赞
     * @param likesBehaviorDto
     * @return {@link ResponseResult}
     */
    @PostMapping("/likes_behavior")
    public ResponseResult likesBehavior(@RequestBody LikesBehaviorDto likesBehaviorDto){
        return userBehaviorService.likesBehavior(likesBehaviorDto);
    }

    /**
     * 阅读
     * @param readBehaviorDto
     * @return {@link ResponseResult}
     */
    @PostMapping("/read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto readBehaviorDto){
        return userBehaviorService.readBehavior(readBehaviorDto);
    }
}
